package com.nbsaas.boot.cms.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.util.Date;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "页面", model = "页面")
@Entity
@Table(name = "bs_page")
@Comment("页面表")
public class Page extends AbstractEntity {

    @Comment("页面标题")
    @SearchItem(name = "title", key = "title", label = "页面标题")
    @FormField(title = "页面标题", sortNum = "1", grid = true, required = true)
    @Column(length = 200, nullable = false)
    private String title;

    @Comment("页面内容")
    @FormField(title = "页面内容", sortNum = "2", type = InputType.richText, col = 23)
    @Column(columnDefinition = "TEXT")
    private String content;

    @Comment("页面别名")
    @FormField(title = "页面别名", sortNum = "3", grid = true)
    @Column(length = 200, unique = true)
    private String alias;

    @Comment("页面模板")
    @FormField(title = "页面模板", sortNum = "4")
    @Column(length = 100)
    private String template;

    @Comment("页面状态")
    @FormField(title = "页面状态", sortNum = "5", grid = true, type = InputType.select)
    @Column(length = 20)
    private String status; // DRAFT-草稿, PUBLISHED-已发布, ARCHIVED-已归档

    @Comment("发布时间")
    @FormField(title = "发布时间", sortNum = "6", type = InputType.date, grid = true)
    private Date publishTime;

    @Comment("排序")
    @FormField(title = "排序", sortNum = "7", grid = true, type = InputType.el_input_number, sort = true)
    private Integer sort;

    @Comment("是否显示")
    @FormField(title = "是否显示", sortNum = "8", grid = true, type = InputType.select)
    private Boolean visible;

    @Comment("访问权限")
    @FormField(title = "访问权限", sortNum = "9", grid = true, type = InputType.select)
    @Column(length = 20)
    private String accessLevel; // PUBLIC-公开, PRIVATE-私有, VIP-VIP用户

    @Comment("SEO标题")
    @FormField(title = "SEO标题", sortNum = "10")
    @Column(length = 200)
    private String seoTitle;

    @Comment("SEO关键词")
    @FormField(title = "SEO关键词", sortNum = "11")
    @Column(length = 500)
    private String seoKeywords;

    @Comment("SEO描述")
    @FormField(title = "SEO描述", sortNum = "12")
    @Column(length = 1000)
    private String seoDescription;

    @Comment("页面类型")
    @FormField(title = "页面类型", sortNum = "13", grid = true, type = InputType.select)
    @Column(length = 20)
    private String pageType; // STATIC-静态页面, DYNAMIC-动态页面, LANDING-落地页

    @Comment("页面布局")
    @FormField(title = "页面布局", sortNum = "14")
    @Column(length = 100)
    private String layout;

    @Comment("自定义CSS")
    @FormField(title = "自定义CSS", sortNum = "15", type = InputType.textarea)
    @Column(columnDefinition = "TEXT")
    private String customCss;

    @Comment("自定义JS")
    @FormField(title = "自定义JS", sortNum = "16", type = InputType.textarea)
    @Column(columnDefinition = "TEXT")
    private String customJs;

    @Comment("访问量")
    @FormField(title = "访问量", sortNum = "17", grid = true, type = InputType.el_input_number, sort = true)
    private Integer viewCount;
} 